* initremote: Avoid creating a remote that is not encrypted when gpg is
broken.
* Support --json and --json-error-messages in more commands
- (addunused, dead, describe, dropunused, expire, fix, init, log, migrate,
- reinit, reinject, rekey, renameremote, rmurl, semitrust, setpresentkey,
- trust, unannex, undo, untrust, unused)
+ (addunused, dead, describe, dropunused, expire, fix, importfeed, init,
+ log, migrate, reinit, reinject, rekey, renameremote, rmurl, semitrust,
+ setpresentkey, trust, unannex, undo, untrust, unused)
* log: When --raw-date is used, display only seconds from the epoch, as
documented, omitting a trailing "s" that was included in the output
before.
* addunused: Displays the names of the files that it adds.
* reinject: Fix support for operating on multiple pairs of files and keys.
* importfeed: Support -J
+ * importfeed: Support --json-progress
-- Joey Hess <id@joeyh.name> Sat, 08 Apr 2023 13:57:18 -0400
import qualified Utility.RawFilePath as R
cmd :: Command
-cmd = notBareRepo $ withAnnexOptions [jobsOption, backendOption] $
+cmd = notBareRepo $ withAnnexOptions os $
command "importfeed" SectionCommon "import files from podcast feeds"
(paramRepeating paramUrl) (seek <$$> optParser)
+ where
+ os = [jobsOption, jsonOptions, jsonProgressOption, backendOption]
data ImportFeedOptions = ImportFeedOptions
{ feedUrls :: CmdParams
-> TMVar (M.Map URLString (Maybe (Maybe [ToDownload])))
-> CommandStart
getFeed url st =
- starting "importfeed" (ActionItemOther (Just (UnquotedString url))) (SeekInput []) $
+ starting "importfeed" (ActionItemOther (Just (UnquotedString url))) (SeekInput [url]) $
get `onException` recordfail
where
record v = liftIO $ atomically $ do
getCache opttemplate = ifM (Annex.getRead Annex.force)
( ret S.empty S.empty
, do
- showStartMessage (StartMessage "importfeed" (ActionItemOther (Just "gathering known urls")) (SeekInput []))
+ j <- jsonOutputEnabled
+ unless j $
+ showStartMessage (StartMessage "importfeed" (ActionItemOther (Just "gathering known urls")) (SeekInput []))
(us, is) <- knownItems
- showEndOk
+ unless j
+ showEndOk
ret (S.fromList us) (S.fromList is)
)
where
recordsuccess = liftIO $ atomically $ putTMVar cv True
startdownloadenclosure :: URLString -> CommandStart
- startdownloadenclosure url = checkknown url $ startUrlDownload cv url $
+ startdownloadenclosure url = checkknown url $ startUrlDownload cv todownload url $
downloadEnclosure addunlockedmatcher opts cache cv todownload url
knownitemid = case getItemId (item todownload) of
downloadmedia linkurl mediaurl mediakey
| rawOption (downloadOptions opts) = startdownloadlink
| otherwise = ifM (youtubeDlSupported linkurl)
- ( startUrlDownload cv linkurl $
+ ( startUrlDownload cv todownload linkurl $
withTmpWorkDir mediakey $ \workdir -> do
dl <- youtubeDl linkurl (fromRawFilePath workdir) nullMeterUpdate
case dl of
addmediafast linkurl mediaurl mediakey =
ifM (pure (not (rawOption (downloadOptions opts)))
<&&> youtubeDlSupported linkurl)
- ( startUrlDownload cv linkurl $ do
+ ( startUrlDownload cv todownload linkurl $ do
runDownload todownload linkurl ".m" cache cv $ \f ->
checkCanAdd (downloadOptions opts) f $ \canadd -> do
addWorkTree canadd addunlockedmatcher webUUID mediaurl f mediakey Nothing
, tryanother
)
-startUrlDownload :: TMVar Bool -> URLString -> CommandPerform -> CommandStart
-startUrlDownload cv url a = starting "addurl"
+startUrlDownload :: TMVar Bool -> ToDownload -> URLString -> CommandPerform -> CommandStart
+startUrlDownload cv todownload url a = starting "addurl"
(ActionItemOther (Just (UnquotedString url)))
- (SeekInput [])
+ (SeekInput [feedurl todownload])
(a `onException` recordfailure)
where
recordfailure = do
* git-annex-reinit
* git-annex-reinject
* git-annex-renameremote
+* git-annex-importfeed
Provisional list of commands that don't support --json and maybe should:
* git-annex-version (--raw already exists, and the output is fairly machine
parseable already. It would be possible to jsonize the output to make it
possibly more machine parseable. But I'm doubtful that would be useful.
-* git-annex-importfeed (implemented w/o using usual command actions,
- which makes warning messages not get put in any particular json record.
- Same problem would also need to be fixed for [[doc/todo/importfeed_parallell]]
- btw.)
These commands have been reviewed and should not support json: